import cv2
#import numpy as np

# 读取图像
image = cv2.imread(r'E:\Data\20230818far_3d.jpg')

# 获取图像宽度和高度
height, width = image.shape[:2]

# 定义旋转角度和旋转中心
angle = 15  # 旋转角度
center = (width // 2, height // 2)  # 旋转中心

# 计算旋转矩阵
rotation_matrix = cv2.getRotationMatrix2D(center, angle, 1.0)
print(rotation_matrix)
# 进行图像旋转
rotated_image = cv2.warpAffine(image, rotation_matrix, (width, height))

# 显示旋转后的图像
cv2.imshow('Rotated Image', rotated_image)
cv2.waitKey(0)
cv2.destroyAllWindows()